package com.vf.user.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.vf.common.annotation.Log;
import com.vf.common.core.controller.BaseController;
import com.vf.common.core.domain.AjaxResult;
import com.vf.common.enums.BusinessType;
import com.vf.user.domain.NoShowComplaints;
import com.vf.user.service.INoShowComplaintsService;
import com.vf.common.utils.poi.ExcelUtil;
import com.vf.common.core.page.TableDataInfo;

/**
 * 爽约投诉Controller
 * 
 * @author LBS
 * @date 2025-06-04
 */
@RestController
@RequestMapping("/user/noShowComplaints")
@Api(tags="爽约投诉")
public class NoShowComplaintsController extends BaseController
{
    @Autowired
    private INoShowComplaintsService noShowComplaintsService;

    /**
     * 查询爽约投诉列表
     */
    @PreAuthorize("@ss.hasPermi('user:noShowComplaints:list')")
    @GetMapping("/list")
    public TableDataInfo list(NoShowComplaints noShowComplaints)
    {
        startPage();
        List<NoShowComplaints> list = noShowComplaintsService.selectNoShowComplaintsList(noShowComplaints);
        return getDataTable(list);
    }

    /**
     * 导出爽约投诉列表
     */
    @PreAuthorize("@ss.hasPermi('user:noShowComplaints:export')")
    @Log(title = "爽约投诉", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, NoShowComplaints noShowComplaints)
    {
        List<NoShowComplaints> list = noShowComplaintsService.selectNoShowComplaintsList(noShowComplaints);
        ExcelUtil<NoShowComplaints> util = new ExcelUtil<NoShowComplaints>(NoShowComplaints.class);
        util.exportExcel(response, list, "爽约投诉数据");
    }

    /**
     * 获取爽约投诉详细信息
     */
    @PreAuthorize("@ss.hasPermi('user:noShowComplaints:query')")
    @GetMapping(value = "/{complaintId}")
    public AjaxResult getInfo(@PathVariable("complaintId") Long complaintId)
    {
        return success(noShowComplaintsService.selectNoShowComplaintsByComplaintId(complaintId));
    }

    /**
     * 新增爽约投诉
     */
    @PreAuthorize("@ss.hasPermi('user:noShowComplaints:add')")
    @Log(title = "爽约投诉", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody NoShowComplaints noShowComplaints)
    {
        return toAjax(noShowComplaintsService.insertNoShowComplaints(noShowComplaints));
    }

    /**
     * 修改爽约投诉
     */
    @PreAuthorize("@ss.hasPermi('user:noShowComplaints:edit')")
    @Log(title = "爽约投诉", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody NoShowComplaints noShowComplaints)
    {
        return toAjax(noShowComplaintsService.updateNoShowComplaints(noShowComplaints));
    }

    /**
     * 删除爽约投诉
     */
    @PreAuthorize("@ss.hasPermi('user:noShowComplaints:remove')")
    @Log(title = "爽约投诉", businessType = BusinessType.DELETE)
	@DeleteMapping("/{complaintIds}")
    public AjaxResult remove(@PathVariable Long[] complaintIds)
    {
        return toAjax(noShowComplaintsService.deleteNoShowComplaintsByComplaintIds(complaintIds));
    }
}
